<%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2025/5/22
  Time: 17:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<script type="text/javascript">
    function register() {
        let username = document.getElementById('username').value;
        let password = document.getElementById('password').value;
        let jsinDate = {"username": username, "password": password}
        let jsonObj = JSON.stringify(jsinDate)
        $.ajax({
            method: 'post',
            url: '${pageContext.request.comntextPath}/stu/register.do',
            contentType:'application/json;charset=utf-8',
            data: jsonObj,
            success:function (resp) {
                alert(resp.username + ":" +resp.password)

            }
        })
    }
</script>
<html>
<head>
    <title>注册页面</title>
</head>
<body>
<%--<form action="${pageContext.request.contextPath}/user/register1.do" method="post">
    用户名：<input type="text" name="user.username"><br>
    密码：<input type="text" name="user.password"><br>
    性别：<input type="text" name="user.sex"><br>
    <input type="submit" value="注册">
</form>--%>
<%--<form action="${pageContext.request.contextPath}/user/register1.do" method="post">
    用户名：<input type="text" name="users[0].username"><br>
    密码：<input type="text" name="users[0].password"><br>
    性别：<input type="text" name="users[0].sex"><br>
    用户名：<input type="text" name="users[1].username"><br>
    密码：<input type="text" name="users[1].password"><br>
    性别：<input type="text" name="users[1].sex"><br>
    <input type="submit" value="注册">
</form>--%>
<form action="${pageContext.request.contextPath}/user/register1.do" method="post">
    用户名：<input type="text" name="maps['username']"><br>
    密码：<input type="text" name="maps['password']"><br>
    性别：<input type="text" name="maps['sex']"><br>
    <input type="submit" value="注册">
</form>
</body>
</html>
